/**
 * 描述: 服务-首页管理
 * 版权: Copyright (c) 2019
 * 公司: 深圳市网商天下科技开发有限公司
 * 作者: 许堉颖
 * 版本: 1.0.0
 * 创建时间: 2019/04/29 16:52
 */
import {Service, RequestParams} from 'vue-element-simple';

// ====================网点管理
/**
 * 分页获取网点列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetRentCarBranchList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('searchValue', params['name']);
  return await this.getService(`/admin/outlets/getPageListByPoint`, request);
};

/**
 * 根据id获取网点信息
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetRentCarBranchDetails = async function (params = {}) {
  const request = new RequestParams();
  // 路线id
  request.put('id', params['id']).checkEmpty('网点id');
  return await this.getService(`/admin/outlets/getInfoByPoint`, request);
};

/**
 * 添加网点
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddRentCarBranch = async function (params = {}) {
  const request = new RequestParams();
  // 机场路线名称
  request.put('name', params['name']).checkEmpty('网点名称');
  // 机场路线类型
  request.put('mobile', params['mobile']).checkEmpty('联系电话');
  // 机场
  request.put('address', params['address']).checkEmpty('详细地址');
  // 省的代码
  request.put('provinceCode', params['provinceCode']).checkEmpty('省份');
  // 市的代码
  request.put('cityCode', params['cityCode']).checkEmpty('市');
  // 区的代码
  request.put('areaCode', params['areaCode']);
  // 评分
  request.put('score', params['score']);
  // 图片
  request.put('picId', params['picId']);
  // 营业时间
  request.put('businessHours', params['businessHours']);
  // 上门服务费
  request.put('serviceFee', params['serviceFee']);
  // 上门范围
  request.put('deliverRange', params['deliverRange']);
  return await this.getService(`/admin/outlets/toAddByPoint`, request);
};

/**
 * 编辑网点
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyRentCarBranch = async function (params = {}) {
  const request = new RequestParams();
  // 机场路线名称
  request.put('id', params['id']);
  // 机场路线名称
  request.put('name', params['name']).checkEmpty('网点名称');
  // 机场路线类型
  request.put('mobile', params['mobile']).checkEmpty('联系电话');
  // 机场
  request.put('address', params['address']).checkEmpty('详细地址');
  // 省的代码
  request.put('provinceCode', params['provinceCode']).checkEmpty('省份');
  // 市的代码
  request.put('cityCode', params['cityCode']).checkEmpty('市');
  // 区的代码
  request.put('areaCode', params['areaCode']);
  // 评分
  request.put('score', params['score']);
  // 图片
  request.put('picId', params['picId']);
  // 营业时间
  request.put('businessHours', params['businessHours']);
  // 上门服务费
  request.put('serviceFee', params['serviceFee']);
  // 上门范围
  request.put('deliverRange', params['deliverRange']);
  return await this.getService(`/admin/outlets/toEditByPoint`, request);
};

/**
 * 删除网点
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteRentCarBranch = async function (params = {}) {
  const request = new RequestParams();
  // 网点id
  request.put('id', params['id']).checkEmpty('网点ID');
  return await this.getService(`/admin/outlets/toDelByPoint`, request);
};

/**
 * 切换网点状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationRentCarBranchChangeStatus = async function (params = {}) {
  const request = new RequestParams();
  // 网点id
  request.put('id', params['id']).checkEmpty('网点ID');
  // 状态
  request.put('status', params['status']).checkEmpty('状态');
  return await this.getService(`/admin/outlets/updateStatusByPoint`, request);
};

// ====================网点管理

// ====================网点车辆管理
/**
 * 分页获取网点车辆列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetRentCarBranchCarList = async function (params = {}) {
  const request = new RequestParams();
  // 网点ID
  request.put('outletId', params['outletId']);
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  // 模糊搜索标题
  request.put('searchValue', params['name']);
  return await this.getService(`/admin/outlets/getPageListByCar`, request);
};

/**
 * 添加网点车辆
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddRentCarBranchCar = async function (params = {}) {
  const request = new RequestParams();
  // 机场路线名称
  request.put('outletId', params['outletId']).checkEmpty('网点ID');
  // 机场路线类型
  request.put('carId', params['carId']).checkEmpty('车型ID');
  // 机场
  request.put('price', params['price']).checkEmpty('日均价');
  // 省的代码
  request.put('weekPrice', params['weekPrice']).checkEmpty('日租价');
  // 市的代码
  request.put('specialPrice', params['specialPrice']);
  // 区的代码
  // request.put('stock', params['stock']).checkEmpty('车辆数');
  // 区的代码
  request.put('plateNumber', params['plateNumber']).checkEmpty('车辆');
  return await this.getService(`/admin/outlets/toAddByCar`, request);
};

/**
 * 编辑网点
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyRentCarBranchCar = async function (params = {}) {
  const request = new RequestParams();
  // 机场路线名称
  request.put('id', params['id']).checkEmpty('车辆ID');
  // 机场路线名称
  request.put('outletId', params['outletId']).checkEmpty('网点ID');
  // 机场路线类型
  request.put('carId', params['carId']).checkEmpty('车型ID');
  // 机场
  request.put('price', params['price']).checkEmpty('日均价');
  // 省的代码
  request.put('weekPrice', params['weekPrice']).checkEmpty('日租价');
  // 市的代码
  request.put('specialPrice', params['specialPrice']);
  // 区的代码
  // request.put('stock', params['stock']).checkEmpty('车辆数');
  // 区的代码
  request.put('plateNumber', params['plateNumber']).checkEmpty('车辆');
  return await this.getService(`/admin/outlets/toEditByCar`, request);
};

/**
 * 删除网点车辆
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteRentCarBranchCar = async function (params = {}) {
  const request = new RequestParams();
  // 网点id
  request.put('id', params['id']).checkEmpty('车辆ID');
  return await this.getService(`/admin/outlets/toDelByCar`, request);
};

/**
 * 切换网点车辆状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationRentCarBranchCarChangeStatus = async function (params = {}) {
  const request = new RequestParams();
  // 网点id
  request.put('id', params['id']).checkEmpty('车辆ID');
  return await this.getService(`/admin/outlets/updateStatusByCar`, request);
};
// ====================网点车辆管理

// ====================附加费用管理
/**
 * 分页获取附加费用列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetRentCarSurchargeList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  return await this.getService(`/admin/outlets/getPageListBySurcharge`, request);
};

/**
 * 添加附加费用
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddRentCarSurcharge = async function (params = {}) {
  const request = new RequestParams();
  // 费用
  request.put('price', params['price']).checkEmpty('费用');
  // 机场路线类型
  request.put('name', params['name']).checkEmpty('附加费用名称');
  // 机场
  request.put('price', params['price']).checkEmpty('日均价');
  // 省的代码
  request.put('mode', params['mode']).checkEmpty('模式');
  // 市的代码
  request.put('desc', params['desc']);
  return await this.getService(`/admin/outlets/toAddBySurcharge`, request);
};

/**
 * 编辑附加费
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyRentCarSurcharge = async function (params = {}) {
  const request = new RequestParams();
  // id
  request.put('id', params['id']).checkEmpty('附加费ID');
  // 费用
  request.put('price', params['price']).checkEmpty('费用');
  // 机场路线类型
  request.put('name', params['name']).checkEmpty('附加费用名称');
  // 机场
  request.put('price', params['price']).checkEmpty('日均价');
  // 省的代码
  request.put('mode', params['mode']).checkEmpty('模式');
  // 市的代码
  request.put('desc', params['desc']);
  return await this.getService(`/admin/outlets/toEditBySurcharge`, request);
};

/**
 * 删除附加费
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteRentCarSurcharge = async function (params = {}) {
  const request = new RequestParams();
  // 网点id
  request.put('id', params['id']).checkEmpty('附加费ID');
  return await this.getService(`/admin/outlets/toDelBySurcharge`, request);
};

/**
 * 切换附加费状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationRentCarSurchargeChangeStatus = async function (params = {}) {
  const request = new RequestParams();
  // 附加费id
  request.put('id', params['id']).checkEmpty('附加费ID');
  return await this.getService(`/admin/outlets/updateStatusBySurcharge`, request);
};
// ====================附加费用管理

// ====================协议管理
/**
 * 分页获取协议列表
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetRentCarAgreementList = async function (params = {}) {
  const request = new RequestParams();
  // 页数
  request.put('page', params['page'], 1);
  // 每页条数
  request.put('pageSize', params['pageSize'], 20);
  return await this.getService(`/admin/outlets/getPageListByAgreement`, request);
};

/**
 * 获取协议详情
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationGetRentCarAgreementDetails = async function (params = {}) {
  const request = new RequestParams();
  // id
  request.put('id', params['id']);
  return await this.getService(`/admin/outlets/getInfoByAgreement`, request);
};

/**
 * 添加网点协议
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationAddRentCarAgreement = async function (params = {}) {
  const request = new RequestParams();
  // 协议名
  request.put('name', params['name']).checkEmpty('协议名');
  // 机场路线类型
  request.put('content', params['content']).checkEmpty('协议内容');
  return await this.getService(`/admin/outlets/toAddByAgreement`, request);
};

/**
 * 编辑协议
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationModifyRentCarAgreement = async function (params = {}) {
  const request = new RequestParams();
  // id
  request.put('id', params['id']).checkEmpty('协议ID');
  // 协议名
  request.put('name', params['name']).checkEmpty('协议名');
  // 机场路线类型
  request.put('content', params['content']).checkEmpty('协议内容');
  return await this.getService(`/admin/outlets/toEditByAgreement`, request);
};

/**
 * 删除协议
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationDeleteRentCarAgreement = async function (params = {}) {
  const request = new RequestParams();
  // 协议id
  request.put('id', params['id']).checkEmpty('协议ID');
  return await this.getService(`/admin/outlets/toDelByAgreement`, request);
};

/**
 * 切换协议状态
 * @param params
 * @returns {Promise.<*>}
 */
Service.applicationRentCarAgreementChangeStatus = async function (params = {}) {
  const request = new RequestParams();
  // 协议id
  request.put('id', params['id']).checkEmpty('协议ID');
  return await this.getService(`/admin/outlets/updateStatusByAgreement`, request);
};
// ====================附加费用管理
